package com.guoqing.example.streams;

import com.google.common.collect.Lists;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * TODO
 *
 * @author zgq
 * @date 2020/10/22 10:23
 */
public class List_BigDecimal_sum {


    public static void main(String[] args) {
        List<String> strings = Lists.newArrayList("1", "2", "3", "4", "5");
        List<String> strings2 = Lists.newArrayList("1", "5");
        boolean b = strings.removeAll(strings2);
        System.out.println(strings);


    }

    public static void main2(String[] args) {
        List<BigDecimal> list = new ArrayList<>();
        list.add(new BigDecimal(1));
        list.add(new BigDecimal(1));
        list.add(new BigDecimal(3));
        BigDecimal orderTotal = list.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
        System.out.println(orderTotal);
    }

    public static void main1(String[] args) {
        List<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(1);
        list.add(3);
        System.out.println(list.stream().mapToInt(Integer::intValue).sum());
    }

}
